<!DOCTYPE html>
<html>
<head>		
	<meta http-equiv="content-type"content="text/html;charset=utf-8">
	<title>javascript显示倒计时</title>
	<style>
	div{font-size:20px;}
	</style>
	<script>
window.onload=function(){
	var curtime=new Date();
	var endtime=new Date("2017,1,27");
	var lefttime=Math.ceil((endtime.getTime()-curtime.getTime())/(24*60*60*1000));
	document.getElementById('showtime').innerHTML="离过年还剩"+lefttime+"天";
	if(curtime >= endtime){
		document.getElementById('showtime').innerHTML="已将过年了，祝您新年快乐";
	}
}

	</script>
</head>
<body>
	<div id="showtime">显示时间位置</div>
</body>
</html>
